Title: SQL W3S (By-BKK) / 120 Data Types
Tags: Obsidian_to_Anki

Q: What does the data type of a SQL column define?
A: It defines what value the column can hold, such as integer, character, money, date and time, or binary

Q: Is each column in a database table required to have a data type?
A: True

Q: What must an SQL developer decide when creating a table?
A: What type of data will be stored inside each column

Q: What is the main purpose of a data type in SQL?
A: It helps SQL understand the type of data expected in each column and how to interact with it

Q: Do data types have the same names and details across all databases?
A: False

Q: State True/False: Always check the documentation for data types and sizes in different databases
A: True

Q: Which are the three main data types in MySQL?
A: String, numeric, and date/time

Q: Name three types of string data types in MySQL
A: CHAR, VARCHAR, TEXT

Q: What does CHAR(size) do in MySQL?
A: Defines a fixed-length string column

Q: How is VARCHAR(size) different from CHAR(size) in MySQL?
A: VARCHAR is variable-length, CHAR is fixed-length

Q: What is a BLOB in MySQL?
A: A Binary Large Object for storing large data, like images or files

Q: What does ENUM(val1, val2, …) data type do in MySQL?
A: Allows only one value from a list of possible values

Q: What is the use of SET(val1, val2, …) in MySQL?
A: Allows 0 or more values from a list of possible values

Q: State True/False: TEXT and LONGTEXT are used for storing very large strings in MySQL
A: True

Q: Give an example for a fixed-length string data type in MySQL
A: CHAR(size)

Q: Give an example of variable-length binary data type in MySQL
A: VARBINARY(size)

Q: State True/False: In MySQL, ENUM can only take values pre-defined in the list
A: True

Q: What type is used for bit-value storage in MySQL?
A: BIT(size)

Q: What does the BOOL or BOOLEAN data type represent in MySQL?
A: True/False values

Q: Name a MySQL numeric data type suitable for very large integers
A: BIGINT(size)

Q: What extra options can numeric types have in MySQL?
A: UNSIGNED or ZEROFILL

Q: What is the DATE data type format in MySQL?
A: YYYY-MM-DD

Q: State True/False: TIMESTAMP in MySQL stores values as seconds since Unix epoch
A: True

Q: In MySQL, which data type would you use for a year?
A: YEAR

Q: What are the three main data type categories in MS SQL Server?
A: String, numeric, date and time

Q: How does char(n) differ from varchar(n) in SQL Server?
A: Char is fixed-length, varchar is variable-length

Q: What is the maximum size for char(n) in SQL Server?
A: 8000 characters

Q: What’s the difference between nchar(n) and char(n) in SQL Server?
A: nchar is Unicode, char is non-Unicode

Q: Which SQL Server data type allows storing XML formatted data?
A: xml

Q: What does the bit data type represent in SQL Server?
A: Integer 0, 1, or NULL

Q: What is used to store a globally unique identifier in SQL Server?
A: uniqueidentifier

Q: Name a SQL Server data type for fixed precision and scale numbers
A: decimal(p,s) or numeric(p,s)

Q: Which SQL Server data type represents money data?
A: money or smallmoney

Q: State True/False: float(n) in SQL Server specifies if the column is 4 or 8 bytes
A: True

Q: What does datetimeoffset data type store in SQL Server?
A: Date, time, and time zone offset

Q: Give an example of an SQL Server data type for storing table results
A: table

Q: State True/False: The timestamp in SQL Server is based on an internal clock and is not a real time value
A: True

Q: What is the maximum length for text data type in MS Access?
A: 255 characters

Q: Which data type would you use in MS Access for a large amount of text?
A: Memo

Q: State True/False: Memo fields in MS Access can be sorted
A: False

Q: What does AutoNumber do in MS Access?
A: Automatically gives each record a unique number

Q: How is Yes/No represented as logical values in MS Access?
A: Displayed as Yes/No, True/False, or On/Off; in code, True is -1, False is 0

Q: Can Yes/No fields in MS Access allow NULL values?
A: False

Q: What is the storage size for Byte in MS Access?
A: 1 byte

Q: State True/False: Hyperlink data type in MS Access stores links to web pages or files
A: True

Q: What is Ole Object used for in MS Access?
A: To store pictures, audio, video, or other Binary Large Objects

Q: What does Lookup Wizard do in MS Access?
A: Creates a drop-down list of options to choose from

Q: Reverse card: CHAR(size) defines a fixed-length string column
A: What is an example of a string data type for fixed length in MySQL?

Q: Reverse card: Only one value from a pre-defined list can be stored
A: What does ENUM data type do in MySQL?

Q: Reverse card: Memo data type stores large text amounts
A: Which data type in MS Access would you use for a field that stores up to 65,536 characters?

Q: Reverse card: Stores a globally unique identifier (GUID)
A: What does the uniqueidentifier data type represent in SQL Server?

Q: Reverse card: YES/NO fields cannot have null values in MS Access
A: Are null values allowed in Yes/No fields in MS Access?

Q: Reverse card: Stores binary large objects like pictures or audio
A: What is the purpose of Ole Object data type in MS Access?[1]